# 线性搜索 python
def LinearSearch(findNumber):
    flag = False
    index = 0
    while (index<len(arr)) and (not flag):
        if arr[index] == findNumber:
            flag = True
        else:
            index +=1
    if flag:
        return index
    else:
        return -1
#
# def LinearSearch2(findNumber):
#     for i in range(len(arr)):
#         if arr[i] == findNumber:
#             return i
#     return -1

if __name__ == '__main__':
    arr = [2,3,4,4,6,7,8,5]
    print(LinearSearch(5))

